package com.sy.controller;

import com.sy.dto.ProvinceTreeNode;
import com.sy.entity.Province;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ProvinceController extends BaseController {
    @RequestMapping(value = "provinces", method = RequestMethod.GET)
    public List<ProvinceTreeNode> getAllProvinces() {
        return provinceService.getAllProvinces();
    }

    @RequestMapping(value = "provinces", method = RequestMethod.GET, params = "pid")
    public Province getProvinceByPid(Integer pid) {
        return provinceService.getProvinceByPid(pid);
    }
}
